<template>
  <div />
</template>

<script>
import Cookies from 'js-cookie'
import applicationUserManager from '@/auth/applicationusermanager'


export default {
  name: 'silentRenew',
  data () {
    return {}
  },
  async mounted () {
    try {
      await applicationUserManager.signinSilentCallback()
      const user = await applicationUserManager.getUser()
      let tokenTime = new Date(user.expires_at*1000)
      this.$cookie.set('ACCESS_TOKEN',user.access_token,{expires:tokenTime});
      this.$cookie.set('TOEKN_TYPE',user.token_type,{expires:tokenTime});
      this.$cookie.set('ID_TOKEN',user.id_token,{expires:tokenTime});
      this.$cookie.set('USER_NAME',user.profile.name,{expires:tokenTime});
      window.localStorage.expires_in = user.expires_in;
    } catch (e) {
      console.log('RefreshToken - catch', e)
      // this.$root.$emit('show-snackbar', { message: e })
    }
  },
  methods: {
  },
}
</script>
